/**
 * 遮罩层，依照jquery-ui方式使用
 */
(function($, undefined) {
	// 遮罩
	$.fn.mask = function(options) {
		var o = $.extend($.fn.mask.defaults, options);
		$(this).css({
					opacity : o.opacity,
					filter : "alpha(opacity=" + (o.opacity * 100) + ")",
					"background-color" : o.color,
					"z-index" : o.zIndex,
					position : "absolute",
					width : "100%",
					height : $(document).height(),
					top : 0,
					left : 0,
					display : "block"
				});
		return this;
	};
	$.fn.mask.defaults = {
		color : "#000000",
		opacity : 0.3,
		zIndex : 198
	};
})(jQuery);

/**
 * 窗口中居中显示选中的对象，但是会移动对象到一个容器中
 */
(function($, undefined) {
	$.fn.centerShow = function(options) {
		var $obj = $(this);
		var width = $obj.outerWidth(true);
		var height = $obj.outerHeight(true);
		if ($.browser.msie && $.browser.version == "6.0") {
			$obj.css({
						"position" : "absolute",
						"display":"block"
					});
		} else {
			$obj.css({
						"position" : "fixed",
						"display":"block"
					});
			
		}
		setPos($obj);
		$(window).resize(function() {
					setPos($obj);
				});
	};

	function setPos($obj, ie6) {

		var width = $obj.outerWidth(true);
		var height = $obj.outerHeight(true);
		if (ie6) {
			$obj.css({
						"left" : Math.floor(($(window).width() - width) / 2),
						'top' : ": expression(eval(document.documentElement.scrollTop+"
								+ Math.floor(($(window).height() - height) / 2)
								+ "))"
					});
		} else {
			$obj.css({
						"left" : Math.floor(($(window).width() - width) / 2),
						"top" : Math.floor(($(window).height() - height) / 2)
					});
		}
	};

	$.fn.centerShow.defaults = {

	};

})(jQuery);
/**
 * 
 */
(function($, undefined) {
	$.fn.msg = function(options) {
		var $obj = $(this);
		var width = $obj.outerWidth(true);
		var height = $obj.outerHeight(true);
		if ($.browser.msie && $.browser.version == "6.0") {
			$obj.css({
						"position" : "absolute",
						"display" : "block",
						visibility : "visible"
					});

			$.fn.centerShow.setPos();
			$(window).resize(function() {
						$.fn.centerShow.setPos($obj);
					}).scroll(function() {
						$.fn.centerShow.setPos($obj);
					});
		} else {

			$obj.css({
						"position" : "fixed"
					});
			$.fn.centerShow.setPos($obj);
		}
	};

	$.fn.centerShow.setPos = function($obj) {

		var width = $obj.outerWidth(true);
		var height = $obj.outerHeight(true);
		$obj.css({
					"left" : Math.floor(($(window).width() - width) / 2),
					"top" : Math.floor(($(window).height() - height) / 2)
							+ $(window).scrollTop()
				});
	};

	$.fn.centerShow.defaults = {

	};

})(jQuery);